package gov.dhs.cis.soa.data;

import gov.dhs.cis.soa.Constants;
import gov.dhs.cis.soa.Utils;
import gov.dhs.cis.soa.Constants.EntityType;

import java.sql.Timestamp;


public class Application extends AbstractSOAData {
	public static final String STEREO_TYPE = "Application";
	
	public int id;
	public String name;
	public String stereoType;
	public String wipt;
	public String appName;
	public transient String function;
	public transient String tech;
	public String database;
	public String disposition;
	public transient String dispRational;
	public String release;
	public String hostConfig;
	public String IST;		//added RSingh - 09/27/2010
	public String maturity;
	public transient String designAspects;
	public transient String relationship;
	public transient Timestamp createdDt = new Timestamp(System.currentTimeMillis());

	public Description desc;

	@Override
	public String toString() {
		String ret = "Application [id=" + id + ", name=" + name + ", Desc = " + desc + "] ";
		return ret;
	}
	
	public void createDescription() {
		StringBuffer txt = new StringBuffer();
		if(Utils.isEmpty(appName))
			appName = "";
		txt.append(Constants.NL+"Application Name = " + appName);
		if(Utils.isEmpty(function))
			function = "";
		txt.append(Constants.NL+"Function = " + function);
		if(Utils.isEmpty(tech))
			tech = "";
		txt.append(Constants.NL+"Technologies = " + tech);
		if(Utils.isEmpty(designAspects))
			designAspects = "";
		txt.append(Constants.NL+"Design Aspects = " + designAspects);
		
		desc = Utils.prepareDescObj(txt.toString(), EntityType.APPL);
	}

//	public static String getUMLId(int entityId) {
//		return EntityType.APPL + "_" + entityId;
//	}

	@Override
	public long getId() {
		return id;
	}
	@Override
	public String getHashableId() {
		return name;
	}

	@Override
	public EntityType getUMLType() {
		return EntityType.APPL;
	}
}

